/*flash.js*/
$(function() {
    var showIndex = 1;
    function showbg(b) {
        var a = $("#flashs .btn1 span").index($("#flashs .btn1 span.cur"));
        if (a < 0) {
            a = 0
        }
        $("#flashs .btn1 span.cur").css("opacity", 0.7).removeClass("cur");
        $("#flashbg" + a).css({
            opacity: 0,
            "z-index": 1
        });
        $("#flashbg" + showIndex).css({
            "z-index": 2
        });
        $("#flashbg" + showIndex).animate({
            opacity: 1
        },
        500);
        $("#flashs .btn1 span").eq(showIndex).css("opacity", 1).addClass("cur")
    }
    var h = $("#flashs .bgitem").css("opacity", 0).length;
    var btn = "<div class='btn1'>";
    for (var i = 0; i < h; i++) {
        btn += "<span>" + (i + 1) + "</span>"
    }
    btn += "</div>";
    $("#flashs").append(btn);
    $("#flashs .btn1 span").css("opacity", 0.7).mouseenter(function() {
        showIndex = $("#flashs .btn1 span").index(this);
        showbg(showIndex)
    }).eq(0).trigger("mouseenter");
    $("#flashs").hover(function() {
        clearInterval(picTimer)
    },
    function() {
        picTimer = setInterval(function() {
            showIndex++;
            if (showIndex == h) {
                showIndex = 0
            }
            showbg(showIndex)
        },
        8000)
    }).eq(0).trigger("mouseleave");
});